package com.yx1996.test.day02;

import com.yx1996.bean.day02.cglib.UserServiceProxyFactory2;
import com.yx1996.bean.day02.service.UserService;
import com.yx1996.bean.day02.service.UserServiceImpl;
import org.junit.Test;

//测试cglib代理(继承了需要代理的对象)
public class test04 {
    @Test
    public void fun1(){
        //创建动态代理工厂
        UserServiceProxyFactory2 factory2 = new UserServiceProxyFactory2();
        //获得动态代理对象
        UserService usProxy = factory2.getUserService();
        //调用动态代理对象增强的方法
        usProxy.add();
        System.out.println(usProxy instanceof UserServiceImpl);
    }
}
